<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <style>
        .container{
            width: 250px;
            height: 200px;
        }
        .title-box{
            display: flex;
            align-items: center;
            color: aliceblue;
            padding: 5px;
            box-sizing: border-box;
            height: 35px;
            background-color: #B1191A;
        }
        .item{
           padding-left: 5px;
           line-height: 30px; 
           background-color: #C81623;
           color: aliceblue;
        }
        .item span{
            margin: 5px;
        }
    </style>
</head>
<body>
    <div id="root">
        <div class="container">
            <div class="title-box">{{categoryTitle}}</div>
            <div class="content-box">
                <div v-for="item in category" class="item">
                    <span v-for="subitem in item.children">{{subitem}}</span>                    
                </div>
            </div>
        </div>
    </div>
    <script>
        new Vue({
            el:'#root',
            data(){
                return{
                    categoryTitle:'全部商品分类',
                    category:[
                        {
                            children:['家用电器']
                        },
                        {
                            children:['手机','数码','相机']
                        },
                        {
                            children:['电脑','办公']
                        }
                    ]
                }
            }
        })
    </script>
</body>
</html>